Quick show on how to use the planetary constants module

planets_pretty shows a pretty table with the units included.


In [41]:
from planetarypy.constants import planets_pretty

In [42]:
planets_pretty


Out[42]:
Mass (10^24kg) Diameter (km) Density (kg/m3) Gravity (m/s2) Escape Velocity (km/s) Rotation Period (hours) Length of Day (hours) Distance from Sun (10^6 km) Perihelion (10^6 km) Aphelion (10^6 km) Orbital Period (days) Orbital Velocity (km/s) Orbital Inclination (degrees) Orbital Eccentricity Axial Tilt (degrees) Mean Temperature (C) Surface Pressure (bars) Number of Moons Ring System? Global Magnetic Field?
MERCURY 0.3300 4879 5427 3.7 4.3 1407.6 4222.6 57.900 46.000 69.800 88.0 47.4 7.0 0.205 0.01 167 0.00 0 0 1
VENUS 4.8700 12104 5243 8.9 10.4 -5832.5 2802.0 108.200 107.500 108.900 224.7 35.0 3.4 0.007 177.40 464 92.00 0 0 0
EARTH 5.9700 12756 5514 9.8 11.2 23.9 24.0 149.600 147.100 152.100 365.2 29.8 0.0 0.017 23.40 15 1.00 1 0 1
MOON 0.0730 3475 3340 1.6 2.4 655.7 708.7 0.384 0.363 0.406 27.3 1.0 5.1 0.055 6.70 -20 0.00 0 0 0
MARS 0.6420 6792 3933 3.7 5.0 24.6 24.7 227.900 206.600 249.200 687.0 24.1 1.9 0.094 25.20 -65 0.01 2 0 0
JUPITER 1898.0000 142984 1326 23.1 59.5 9.9 9.9 778.600 740.500 816.600 4331.0 13.1 1.3 0.049 3.10 -110 NaN 67 1 1
SATURN 568.0000 120536 687 9.0 35.5 10.7 10.7 1433.500 1352.600 1514.500 10747.0 9.7 2.5 0.057 26.70 -140 NaN 62 1 1
URANUS 86.8000 51118 1271 8.7 21.3 -17.2 17.2 2872.500 2741.300 3003.600 30589.0 6.8 0.8 0.046 97.80 -195 NaN 27 1 1
NEPTUNE 102.0000 49528 1638 11.0 23.5 16.1 16.1 4495.100 4444.500 4545.700 59800.0 5.4 1.8 0.011 28.30 -200 NaN 14 1 1
PLUTO 0.0131 2390 1830 0.6 1.1 -153.3 153.3 5870.000 4435.000 7304.300 90588.0 4.7 17.2 0.244 122.50 -225 0.00 5 0 NaN

In [43]:
planets_pretty.dtypes


Out[43]:
Mass (10^24kg)                   float64
Diameter (km)                      int64
Density (kg/m3)                    int64
Gravity (m/s2)                   float64
Escape Velocity (km/s)           float64
Rotation Period (hours)          float64
Length of Day (hours)            float64
Distance from Sun (10^6 km)      float64
Perihelion (10^6 km)             float64
Aphelion (10^6 km)               float64
Orbital Period (days)            float64
Orbital Velocity (km/s)          float64
Orbital Inclination (degrees)    float64
Orbital Eccentricity             float64
Axial Tilt (degrees)             float64
Mean Temperature (C)               int64
Surface Pressure (bars)          float64
Number of Moons                    int64
Ring System?                     float64
Global Magnetic Field?           float64
dtype: object

... while planets provides a dataframe that has an easier to use dataframe index with

  • units removed
  • spaces replaced by underscore
  • all lower case

In [44]:
from planetarypy.constants import planets

In [45]:
planets


Out[45]:
mass diameter density gravity escape_velocity rotation_period length_of_day distance_from_sun perihelion aphelion orbital_period orbital_velocity orbital_inclination orbital_eccentricity axial_tilt mean_temperature surface_pressure number_of_moons is_ring_system has_global_magnetic_field
MERCURY 0.3300 4879 5427 3.7 4.3 1407.6 4222.6 57.900 46.000 69.800 88.0 47.4 7.0 0.205 0.01 167 0.00 0 0 1
VENUS 4.8700 12104 5243 8.9 10.4 -5832.5 2802.0 108.200 107.500 108.900 224.7 35.0 3.4 0.007 177.40 464 92.00 0 0 0
EARTH 5.9700 12756 5514 9.8 11.2 23.9 24.0 149.600 147.100 152.100 365.2 29.8 0.0 0.017 23.40 15 1.00 1 0 1
MOON 0.0730 3475 3340 1.6 2.4 655.7 708.7 0.384 0.363 0.406 27.3 1.0 5.1 0.055 6.70 -20 0.00 0 0 0
MARS 0.6420 6792 3933 3.7 5.0 24.6 24.7 227.900 206.600 249.200 687.0 24.1 1.9 0.094 25.20 -65 0.01 2 0 0
JUPITER 1898.0000 142984 1326 23.1 59.5 9.9 9.9 778.600 740.500 816.600 4331.0 13.1 1.3 0.049 3.10 -110 NaN 67 1 1
SATURN 568.0000 120536 687 9.0 35.5 10.7 10.7 1433.500 1352.600 1514.500 10747.0 9.7 2.5 0.057 26.70 -140 NaN 62 1 1
URANUS 86.8000 51118 1271 8.7 21.3 -17.2 17.2 2872.500 2741.300 3003.600 30589.0 6.8 0.8 0.046 97.80 -195 NaN 27 1 1
NEPTUNE 102.0000 49528 1638 11.0 23.5 16.1 16.1 4495.100 4444.500 4545.700 59800.0 5.4 1.8 0.011 28.30 -200 NaN 14 1 1
PLUTO 0.0131 2390 1830 0.6 1.1 -153.3 153.3 5870.000 4435.000 7304.300 90588.0 4.7 17.2 0.244 122.50 -225 0.00 5 0 NaN

In [46]:
planets.dtypes


Out[46]:
mass                         float64
diameter                       int64
density                        int64
gravity                      float64
escape_velocity              float64
rotation_period              float64
length_of_day                float64
distance_from_sun            float64
perihelion                   float64
aphelion                     float64
orbital_period               float64
orbital_velocity             float64
orbital_inclination          float64
orbital_eccentricity         float64
axial_tilt                   float64
mean_temperature               int64
surface_pressure             float64
number_of_moons                int64
is_ring_system               float64
has_global_magnetic_field    float64
dtype: object

One can also directly import a planet which will be a pandas Series and is in fact just a column of above table.


In [40]:
from planetarypy.constants import mars
mars


Out[40]:
mass                            0.642
diameter                     6792.000
density                      3933.000
gravity                         3.700
escape_velocity                 5.000
rotation_period                24.600
length_of_day                  24.700
distance_from_sun             227.900
perihelion                    206.600
aphelion                      249.200
orbital_period                687.000
orbital_velocity               24.100
orbital_inclination             1.900
orbital_eccentricity            0.094
axial_tilt                     25.200
mean_temperature              -65.000
surface_pressure                0.010
number_of_moons                 2.000
is_ring_system                  0.000
has_global_magnetic_field       0.000
Name: MARS, dtype: float64